# Contributor: Mike Crute <mike@crute.us>
# Maintainer:  Mike Crute <mike@crute.us>
pkgname=nmon
pkgver=16n
pkgrel=0
pkgdesc="Nigel's performance Monitor for Linux"
url="http://nmon.sourceforge.net/"
arch="all"
license="BSD-3-Clause"
options="!check" # no upstream tests
makedepends="ncurses-dev"
source="
	glibc.patch

	http://sourceforge.net/projects/nmon/files/lmon$pkgver.c
	"

prepare() {
	mkdir "$builddir"
	cp lmon$pkgver.c "$builddir"/lmon.c
	default_prepare
}

build() {
	case "$CARCH" in
		ppc64le)		_BUILD_ARCH="POWER" ;;
		s390x)			_BUILD_ARCH="MAINFRAME" ;;
		arm*|aarch64)	_BUILD_ARCH="ARM" ;;
		*)				_BUILD_ARCH="X86" ;;
	esac

	echo "Building for $_BUILD_ARCH"
	cc -o nmon lmon.c -g -O3 -Wall -lncurses -lm \
		-D $_BUILD_ARCH -D JFS -D GETUSER -D LARGEMEM
}

package() {
	install -Dm0755 nmon "$pkgdir"/usr/bin/nmon
}

sha512sums="
c6749baeeefbb5fa781badcf0a3b1a77792498663155b70f00ae8da751eb72ac38f1f734fd9e2eb32cb364938e366453f50e29928f247b945b684021fbde9af5  glibc.patch
7b801e3d8a1d60794993af6572b8db04aa0bc707cebd16404c6ad9056f4c37216d57e894241540405192bf76a7e0a49f2e31b55b1721c7eb9da437808ff5abda  lmon16n.c
"
